import {fetchChannelListApi} from '@/api/ChannelList.ts'
import type {ChannelRes} from "@/api/ChannelList.ts"
import {useEffect, useState} from "react";

function useTabs() {
    const [channelList, setChannelList] = useState<ChannelRes[]>([])
    useEffect(() => {
        const getChannelList = async () => {
            try {
                const res = await fetchChannelListApi()
                // @ts-ignore
                setChannelList(res.data.data.channels)
            } catch (error) {
                console.log(error)
            }
        }
        getChannelList()
    }, []);

    return {
        channelList
    }
}

export {
    useTabs
}